package com.jzr.medical.db1.vo;

import com.jzr.common.util.U;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.List;

@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class UserCodeVo implements Serializable {
    /**
     * 用户代码
     */
    @ApiModelProperty("用户代码")
    private String userCode;

    /**
     * 用户名称
     */
    @ApiModelProperty("用户名称")
    private String userName;

    public static String lookupName(List<UserCodeVo> codeList, String userCode){
        if(U.isBlank(userCode)){
            return "";
        }
        for(UserCodeVo c : codeList){
            if(c.getUserCode().equalsIgnoreCase(userCode)){
                return c.getUserName();
            }
        }
        return "";
    }
}
